package com.xcc.factorypattern.demo01;

/**
 * @Description: PizzaStore
 * @Author: xiechuang
 * @Date: 2022/9/2
 */
public class PizzaStore {

    /**
     * 点披萨
     *
     * @param type 披萨类型
     * @return
     */
    public Pizza orderPizza(String type) {
        Pizza pizza;

        if ("cheese".equals(type)) {
            pizza = new CheesePizza();
        } else if ("greek".equals(type)) {
            pizza = new GreekPizza();
        } else if ("pepperoni".equals(type)) {
            pizza = new PepperoniPizza();
        } else {
            pizza = new CheesePizza();
        }

        pizza.prepare();
        pizza.bake();
        pizza.cut();
        pizza.box();

        System.out.println("pizza complete!");

        return pizza;
    }

}
